﻿@model IEnumerable<Domain.Nome>
@{
    ViewBag.Title = "SignificadoNome";
}

@section facebookMetaTags
{
    <meta property="og:title" content="Significado do nome @ViewBag.Nome" name="tit"/>
    <meta property="og:type" content="article"/>
    <meta property="og:url" content="@Request.Url" name="url"/>
    <meta property="og:description" content="@ViewBag.Descricao" name ="descr"/>
    <meta property="og:image" content="http://www.cantinhodacegonha.com/content/images/cegonha_2.png"/>
    <meta property="og:site_name" content="Cantinho da cegonha"/>
    <meta property="fb:page_id" content="231110590236634"/>
}

<script src="../../Scripts/jquery.listnav.min-2.1.js" type="text/javascript"></script>
<script src="../../Scripts/JqueryScroll.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function ($) {

        if (qs["nome"] == null || qs["nome"].indexOf("Pesquisa") != -1) {
            $('#LstNome').listnav({
                //onClick: function (letter) { alert('You clicked ' + letter); },
                includeNums: false,
                includeAll: false,
                noMatchText: 'O nome pesquisado não foi encontrado.'
            });
        } else {
            $('#LstNome').listnav({
                //onClick: function (letter) { alert('You clicked ' + letter); },
                includeNums: false,
                includeAll: false,
                noMatchText: 'O nome pesquisado não foi encontrado.',
                initLetter: qs["nome"].substring(0, 1)
            });
        }

        $("#nome").Watermark("Pesquisar outro nome");
        $(".scroll").jScroll();

        $(window).scroll(function () {
            var scrollPosition = $(window).height() + $(window).scrollTop();
            if (scrollPosition >= 866) {
                $("#resultsR").show();
            } else
            { $("#resultsR").hide(); }
        });


    });

    var qs = (function (a) {
        if (a == "") return {};
        var b = {};
        for (var i = 0; i < a.length; ++i) {
            var p = a[i].split('=');
            if (p.length != 2) continue;
            b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
        }
        return b;
    })(window.location.search.substr(1).split('&'));

    function FillDetails(obj) {
        var resp = eval("(" + obj.responseText + ")");
        if (resp.Genero == "F") { resp.style = "color:#E85B85;"; }
        else { resp.style = "color:#41748C;"; }

        $("#mensagem").empty();
        $("#results").empty();
        $("#resultsR").empty();

        $("#nomedetail").hide();
        $("#nomedetail").fadeIn("slow");
        $("#movieTemplate").tmpl(resp).appendTo("#results");

        $("#nomedetailR").hide();
        $("#nomedetailR").fadeIn("slow");
        $("#movieTemplateR").tmpl(resp).appendTo("#resultsR");
        var urllike = "http://www.cantinhodacegonha.com/Tools/SignificadoNome?nome=" + resp.NomeProprio;
        $('meta[name=url]').attr('content', urllike);
        $('meta[name=descr]').attr('content', resp.Descricao);
        $('meta[name=tit]').attr('content', 'Significado do nome ' + resp.NomeProprio);

        var url = $.param.fragment();

        $.bbq.pushState({ nome: resp.NomeProprio });
        //$('html, body').animate({ scrollTop: 0 }, 'slow');
        $("#face").append(resp.FacebookUrl);
        $("#faceR").append(resp.FacebookUrl);
    }
</script>


<div class="leftCol">
@Html.Partial("_LeftMenu")
<div class="separator_green">
@Html.Partial("_PubVertical")
</div>
<div class="clear"></div>
</div>
<div class="centerCol" style="width:750px;margin-left:40px;">	
<h1>Significado dos nomes</h1>
<div>
@using (Html.BeginForm("SignificadoNome", "Tools",FormMethod.Get))
{
    <input id="nome" type="text" name="nome" class="input_text" style="width:158px;display:inline;"/> 
    <input  type="submit" value=">>" id="btnPostNameFind"/>
}
</div>
<div class="separator_green" style="padding-top: 1px;margin-bottom: 1px;margin-top: 15px;"></div>
<script id="movieTemplate" type="text/x-jquery-tmpl">
<li><h2 style="${style}">${NomeProprio}<span id="face" style="margin-left:10px"></span></h2></li>
<li><b style="font-size: 15px;">Significado:</b> ${Descricao}</li>
</script>
<script id="movieTemplateR" type="text/x-jquery-tmpl">
<li><h2 style="${style}">${NomeProprio}<span id="faceR"></span></h2></li>
<li><b style="font-size: 15px;">Significado:</b> ${Descricao}</li>
</script>
<div id="nomedetail">
<ul id="results">@Html.Raw(ViewBag.DescricaoNome)</ul>
</div>
<br />
<div id="mensagem">
<p>@Html.Raw(ViewBag.mensagem)</p>
</div>
<br />

<div style="border-top: 5px solid #9FC9C9; width: 576px;">
@using (Html.BeginForm("SignificadoNome", "Tools", FormMethod.Get))
{
    <text>Filtrar por sexo:</text>
    @Html.RadioButton("gender", "all", ViewBag.gender == null ? true : false, new { onchange = "this.form.submit();" }) <text>Todos</text>
    @Html.RadioButton("gender", "M", ViewBag.gender == "M" ? true : false, new { onchange = "this.form.submit();" }) <text>Masculino</text>
    @Html.RadioButton("gender", "F", ViewBag.gender == "F" ? true : false, new { onchange = "this.form.submit();" }) <text>Feminino</text>

}
</div>
<br />


<div id="LstNome-nav" class="listNav"></div>

<ul id="LstNome" class="lstNomes" style="width: 585px; float: left;">
@foreach (var item in Model)
{
    <text><li>@Ajax.ActionLink(item.NomeProprio, "NomeDetails", "Tools", new { id = item.Id }, new AjaxOptions { HttpMethod = "Post", OnComplete = "FillDetails" }, new { @class = item.Genero })</li></text>
}
</ul>
<div style="float: left; width: 160px; margin-left: 5px;" class="scroll">
<div style="display: block; float: left; width: 165px;" id="nomedetailR">
<ul id="resultsR">@Html.Raw(ViewBag.DescricaoNome)</ul>
</div>
</div>
<div class="clear"></div>
</div>

<div class="clear"></div>
<script src="../../Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
<script src="../../Scripts/jQuery.tmpl.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.ba-bbq.min.js" type="text/javascript"></script>

